Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@ljharb/through
Advanced tools
Note: This package is a fork of https://npmjs.com/through, and builds off of it.
Easy way to create a Stream
that is both readable
and writable
.
write
and end
methods.through
takes care of pause/resume logic if you use this.queue(data)
instead of this.emit('data', data)
.this.pause()
and this.resume()
to manage flow.this.paused
to see current flow state. (write
always returns !this.paused
).This function is the basis for most of the synchronous streams in event-stream.
var through = require('@ljharb/through')
through(function write(data) {
this.queue(data) //data *must* not be null
},
function end () { //optional
this.queue(null)
})
Or, can also be used without buffering on pause, use this.emit('data', data)
,
and this.emit('end')
var through = require('@ljharb/through')
through(function write(data) {
this.emit('data', data)
//this.pause()
},
function end () { //optional
this.emit('end')
})
You will probably not need these 99% of the time.
By default, through
emits close when the writable
and readable side of the stream has ended.
If that is not desired, set autoDestroy=false
.
var through = require('@ljharb/through')
//like this
var ts = through(write, end, {autoDestroy: false})
//or like this
var ts = through(write, end)
ts.autoDestroy = false
v2.3.13 - 2024-03-08
8e77c7b
0a0a33f
653e55d
65ab32c
@arethetypeswrong/cli
, tape
, typescript
1d2c513
@types/node
, typescript
d5bdc23
call-bind
2633dc6
@types/node
fe34373
FAQs
simplified stream construction
The npm package @ljharb/through receives a total of 1,374,861 weekly downloads. As such, @ljharb/through popularity was classified as popular.
We found that @ljharb/through demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.